(define colors
  '((white 0)
    (black 1)
    (blue 2)
    (green 3)
    (light-red 4)
    (brown 5)
    (purple 6)
    (orange 7)
    (yellow 8)
    (light-green 9)
    (cyan 10)
    (light-cyan 11)
    (light-blue 12)
    (pink 13)
    (grey 14)
    (light-grey 15)))

(define (rainbow-aux string colorwheel)
  (if (null? string)
      colorwheel
      (if (null? colorwheel)
          (rainbow-aux string colors)
          (begin
            (display (integer->char 3))
            (display (car (cdr (car colorwheel))))
            (display (car string))
            (rainbow-aux (cdr string) (cdr colorwheel))))))

(define (rainbow-times-aux string n colorwheel)
  (if (> n 0)
      (let* ((colorwheel* (rainbow-aux string colorwheel)))
        (newline)
        (rainbow-times-aux string (- n 1) colorwheel*))
      #t))

(define (rainbow-times string n)
  (rainbow-times-aux (string->list string) n colors))

(define (rainbow string)
  (rainbow-aux (string->list string) colors)
  (newline))

(define t1 (rainbow-times "irc rainbow text!!!" 10))
